home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / PROPSHET.PAK / GLOBALS.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  6KB  |  150 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12.  
  13. //-------------------------------------------------------------------------
  14. // Functions for handling main window messages.  The message-dispatching
  15. // mechanism expects all message-handling functions to have the following
  16. // prototype:
  17. //
  18. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  19.  
  20. // **TODO**  Add message-handling function prototypes here.  Be sure to
  21. //           add the function names to the main window message table in
  22. //           generic.c.
  23.  
  24. LRESULT MsgCreate(HWND, UINT, WPARAM, LPARAM);
  25. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  26. LRESULT MsgPaint(HWND, UINT, WPARAM, LPARAM);
  27. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  28.  
  29.  
  30. //-------------------------------------------------------------------------
  31. // Functions for handling main window commands--ie. functions for
  32. // processing WM_COMMAND messages based on the wParam value.
  33. // The message-dispatching mechanism expects all command-handling
  34. // functions to have the following prototype:
  35. //
  36. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  37.  
  38. // **TODO**  Add message-handling function prototypes here.  Be sure to
  39. //           add the function names to the main window command table in
  40. //           generic.c.
  41.  
  42. LRESULT CmdPropShet(HWND, WORD, WORD, HWND);
  43. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  44. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  45.  
  46.  
  47. //-------------------------------------------------------------------------
  48. // Global function prototypes.
  49.  
  50. // **TODO**  Add global function prototypes here.
  51.  
  52. BOOL InitApplication(HINSTANCE, int);
  53. BOOL CenterWindow(HWND, HWND);
  54.  
  55.     // Callback functions.  These are called by Windows.
  56.  
  57. // **TODO**  Add new callback function prototypes here.
  58.  
  59. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  60. LRESULT CALLBACK BackgrndDialogProc(HWND, UINT, WPARAM, LPARAM);
  61. LRESULT CALLBACK RectangleDialogProc(HWND, UINT, WPARAM, LPARAM);
  62.  
  63.  
  64. //-------------------------------------------------------------------------
  65. // Global variable declarations.
  66.  
  67. extern HINSTANCE hInst;          // The current instance handle
  68. extern char      szAppName[];    // The name of this application
  69. extern char      szTitle[];      // The title bar text
  70. extern HBRUSH ghBrushRed;  
  71. extern HBRUSH ghBrushGreen;
  72. extern HBRUSH ghBrushBlue; 
  73.  
  74. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  75. //           line 2.  For MDI applications, uncomment line 2 below, comment
  76. //           line 1, and then define hwndMDIClient as a global variable in
  77. //           INIT.C
  78. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  79. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  80.  
  81.  
  82. //-------------------------------------------------------------------------
  83. // Message and command dispatch infrastructure.  The following type
  84. // definitions and functions are used by the message and command dispatching
  85. // mechanism and do not need to be changed.
  86.  
  87.     // Function pointer prototype for message handling functions.
  88. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  89.  
  90.     // Function pointer prototype for command handling functions.
  91. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  92.  
  93.     // Enumerated type used to determine which default window procedure
  94.     // should be called by the message- and command-dispatching mechanism
  95.     // if a message or command is not handled explicitly.
  96. typedef enum
  97. {
  98.    edwpNone,            // Do not call any default procedure.
  99.    edwpWindow,          // Call DefWindowProc.
  100.    edwpDialog,          // Call DefDlgProc (This should be used only for
  101.                         // custom dialogs - standard dialog use edwpNone).
  102.    edwpMDIChild,        // Call DefMDIChildProc.
  103.    edwpMDIFrame         // Call DefFrameProc.
  104. } EDWP;                // Enumeration for Default Window Procedures
  105.  
  106.     // This structure maps messages to message handling functions.
  107. typedef struct _MSD
  108. {
  109.     UINT   uMessage;
  110.     PFNMSG pfnmsg;
  111. } MSD;                 // MeSsage Dispatch structure
  112.  
  113.     // This structure contains all of the information that a window
  114.     // procedure passes to DispMessage in order to define the message
  115.     // dispatching behavior for the window.
  116. typedef struct _MSDI
  117. {
  118.     int  cmsd;          // Number of message dispatch structs in rgmsd
  119.     MSD *rgmsd;         // Table of message dispatch structures
  120.     EDWP edwp;          // Type of default window handler needed.
  121. } MSDI, FAR *LPMSDI;   // MeSsage Dipatch Information
  122.  
  123.     // This structure maps command IDs to command handling functions.
  124. typedef struct _CMD
  125. {
  126.     WORD   wCommand;
  127.     PFNCMD pfncmd;
  128. } CMD;                 // CoMmand Dispatch structure
  129.  
  130.     // This structure contains all of the information that a command
  131.     // message procedure passes to DispCommand in order to define the
  132.     // command dispatching behavior for the window.
  133. typedef struct _CMDI
  134. {
  135.     int  ccmd;          // Number of command dispatch structs in rgcmd
  136.     CMD *rgcmd;         // Table of command dispatch structures
  137.     EDWP edwp;          // Type of default window handler needed.
  138. } CMDI, FAR *LPCMDI;   // CoMmand Dispatch Information
  139.  
  140.     // Message and command dispatching functions.  They look up messages
  141.     // and commands in the dispatch tables and call the appropriate handler
  142.     // function.
  143. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  144. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  145.  
  146.     // Message dispatch information for the main window
  147. extern MSDI msdiMain;
  148.     // Command dispatch information for the main window
  149. extern CMDI cmdiMain;
  150.